﻿using System;
using Glue;
using Xunit;

namespace GlueTests
{
    public class SameTypeMappingTest
    {
        public class ClassA
        {
            public InnerClass InnerClass { get; set; }
        }
        public class ClassB
        {
            public InnerClass InnerClass { get; set; }
        }
        public class InnerClass
        {
            public String Nothing{ get; set; }
        }

        [Fact]
        public void Using_simplified_nested_mapping_should_work()
        {
            var mapping = new Mapping<ClassA, ClassB>();
            mapping.Relate(x=>x.InnerClass.Nothing,y=>y.InnerClass.Nothing);
            var result = mapping.Map(new ClassA {InnerClass = new InnerClass {Nothing = "Nothing"}},
                                     new ClassB {InnerClass = new InnerClass()});
            Assert.Equal("Nothing",result.InnerClass.Nothing);
        }
    }
}
